import json


def read_config(file_name):
    with open(file_name) as f:
        try:
            return json.load(f)
        except BaseException:
            exit(1)


def write_config(file_name, data):
    with open(file_name, "w", encoding="utf-8") as f:
        try:
            json.dump(data, f, ensure_ascii=False, indent=4)
            return True
        except BaseException:
            exit(1)
